<?php
/**
 * Created by PhpStorm.
 * User: Lzhy ysjywz@gmail.com
 * Date: 2018/5/21
 * Time: 下午2:35
 */
namespace admin\controller;
class index extends _base
{

    /**
     * @Notes:首页
     * @Interface index
     * @author: LZH
     * @Time: 2019/6/18   17:26
     */
    public function index()
    {
        $date = I('date')?I('date'):1;
        switch ($date){
            //日
            case 1:
                $datetime = mktime(0,0,0,date('m'),date('d'),date('Y'));
                break;
            //月
            case 2:
                $datetime = mktime(0,0,0,date('m'),1,date('Y'));
                break;
            //年
            case 3:
                $datetime = mktime(0, 0, 0, 1, 1, date('Y'));
                break;
        }
        $aParams1['where']['creation_date >='] = $datetime;

        //总收入
        $aParams1['field'] = ['SUM(pay_price) as order_money','COUNT(*) as order_paynum'];
        $aParams1['where']['status !='] = 1;
        $aData = M('order')->top($aParams1)[0];

        $this->display('index',['aData'=>$aData]);
    }

    /**
     * @Notes:没有权限
     * @Interface auth
     * @author: LZH
     * @Time: 2019/6/18   17:26
     */
    public function auth(){
        $this->display('auth');
    }
} 

